home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2005 October / PCWOCT05.iso / Software / FromTheMag / XAMPP 1.4.14 / xampp-win32-1.4.14-installer.exe / xampp / phpMyAdmin / libraries / url_generating.lib.php < prev    next >
PHP Script  |  2004-07-17  |  3KB  |  98 lines

  1. <?php
  2. /* $Id: url_generating.lib.php,v 2.3 2004/07/17 22:58:31 rabus Exp $ */
  3. // vim: expandtab sw=4 ts=4 sts=4:
  4.  
  5.  
  6. /**
  7.  * URL/hidden inputs generating.
  8.  */
  9.  
  10.  
  11. /**
  12.  * Generates text with hidden inputs.
  13.  *
  14.  * @param   string   optional database name
  15.  * @param   string   optional table name
  16.  * @param   int      indenting level
  17.  *
  18.  * @return  string   string with input fields
  19.  *
  20.  * @global  string   the current language
  21.  * @global  string   the current conversion charset
  22.  * @global  string   the current connection collation
  23.  * @global  string   the current server
  24.  * @global  array    the configuration array
  25.  * @global  boolean  whether recoding is allowed or not
  26.  *
  27.  * @access  public
  28.  *
  29.  * @author  nijel
  30.  */
  31. function PMA_generate_common_hidden_inputs ($db = '', $table = '', $indent = 0, $skip = array())
  32. {
  33.     global $lang, $convcharset, $collation_connection, $server;
  34.     global $cfg, $allow_recoding;
  35.     
  36.     if (!is_array($skip)) {
  37.         $skip = array($skip);
  38.     }
  39.  
  40.     $spaces = '';
  41.     for ($i = 0; $i < $indent; $i++) {
  42.         $spaces .= '    ';
  43.     }
  44.  
  45.     $result = $spaces . '<input type="hidden" name="lang" value="' . $lang . '" />' . "\n"
  46.             . $spaces . '<input type="hidden" name="server" value="' . $server . '" />' . "\n";
  47.     if (!in_array('convcharset', $skip) && isset($cfg['AllowAnywhereRecoding']) && $cfg['AllowAnywhereRecoding'] && $allow_recoding)
  48.         $result .= $spaces . '<input type="hidden" name="convcharset" value="' . $convcharset . '" />'  . "\n";
  49.     if (!in_array('collation_connection', $skip) && isset($collation_connection))
  50.         $result .= $spaces . '<input type="hidden" name="collation_connection" value="' . $collation_connection . '" />'  . "\n";
  51.     if (!in_array('db', $skip) && !empty($db))
  52.         $result .= $spaces . '<input type="hidden" name="db" value="'.htmlspecialchars($db).'" />' . "\n";
  53.     if (!in_array('table', $skip) && !empty($table))
  54.         $result .= $spaces . '<input type="hidden" name="table" value="'.htmlspecialchars($table).'" />' . "\n";
  55.     return $result;
  56. }
  57.  
  58. /**
  59.  * Generates text with URL parameters.
  60.  *
  61.  * @param   string   optional database name
  62.  * @param   string   optional table name
  63.  * @param   string   character to use instead of '&' for deviding
  64.  *                   multiple URL parameters from each other
  65.  *
  66.  * @return  string   string with URL parameters
  67.  *
  68.  * @global  string   the current language
  69.  * @global  string   the current conversion charset
  70.   * @global  string   the current connection collation
  71.  * @global  string   the current server
  72.  * @global  array    the configuration array
  73.  * @global  boolean  whether recoding is allowed or not
  74.  *
  75.  * @access  public
  76.  *
  77.  * @author  nijel
  78.  */
  79. function PMA_generate_common_url ($db = '', $table = '', $amp = '&')
  80. {
  81.     global $lang, $convcharset, $collation_connection, $server;
  82.     global $cfg, $allow_recoding;
  83.  
  84.     $result = 'lang=' . $lang
  85.        . $amp . 'server=' . $server;
  86.     if (isset($cfg['AllowAnywhereRecoding']) && $cfg['AllowAnywhereRecoding'] && $allow_recoding)
  87.         $result .= $amp . 'convcharset=' . urlencode($convcharset);
  88.     if (isset($collation_connection))
  89.         $result .= $amp . 'collation_connection=' . urlencode($collation_connection);
  90.     if (!empty($db))
  91.         $result .= $amp . 'db='.urlencode($db);
  92.     if (!empty($table))
  93.         $result .= $amp . 'table='.urlencode($table);
  94.     return $result;
  95. }
  96.  
  97. ?>
  98.